void echo(){

    int i, inum, length=0,j,chk;
char content[1024];
char filename[1024];
     if(argc!=4&&argc!=5)
    {
        printf("the command need four or five args\n");
        return;
    }
    if(argc==5)
    {
        if(strcmp(argv[2],"-a")!=0&&strcmp(argv[3],">")!=0)
        {
              printf("error command\n");
        return ;
        }
            strcpy(filename,argv[4]);
    }

    else
    {
        if(strcmp(argv[2],">")!=0)
              {
              printf("error command\n");
        return ;
        }
        strcpy(filename,argv[3]);
    }


    for(i = 0; i < INODENUM; i++)
if((inode_array[i].inum > 0) &&
(inode_array[i].type == '-') &&
!strcmp(inode_array[i].file_name,filename))
break;//已存在文件
if(i == INODENUM)//不存在文件
{//创建文件
    for(i = 0; i < INODENUM; i++)
if(inode_array[i].inum < 0) break;
inode_array[i].inum = i;
strcpy(inode_array[i].file_name, filename);
inode_array[i].type = '-';
strcpy(inode_array[i].user_name, user.user_name);
inode_array[i].iparent = inum_cur;
inode_array[i].length = 0;
save_inode(i);
}
inum = i;
chk=check(i);
if(chk!=1)
{
printf("This file is not your !\n");
return ;
}

     strcpy(content,argv[1]);
    for(j=0;content[j]!='\0';j++)
         length++;//计算文件长度
if(argc==4)//写进文件
{
    inode_array[inum].length = length;
inode_array[inum].address[0] = get_blknum();
if(length > 512)
inode_array[inum].address[1] = get_blknum();
save_inode(inum);
strcpy(temp,content);
write_blk(inum);
}
else if(argc==5)//文件内容追加
{
     inode_array[inum].length+= length;
     inode_array[inum].address[0] = get_blknum();
if(length > 512)
inode_array[inum].address[1] = get_blknum();
save_inode(inum);
strncat(temp,content,length);//追加
write_blk(inum);

}

}
